<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>考神驾到手机站新闻详细页</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
    <link rel="stylesheet" type="text/css" href="css/public.css">
    <script type="text/javascript" src="js/jquery.min.js"></script>
    <script type="text/javascript" src="js/windowsheight.js"></script>

    <script src="${pageContext.request.contextPath}/manager_page/layui/layui.js"></script>
</head>

<body>

<input type="hidden" id="news_id_hidden" value=${param.news_id_hidden} >

<!-----------头部开始--------------->
<%@ include file="page_head.jsp"%>
<!-----------头部结束--------------->
<!-----------内容开始--------------->
<div class="content">
    <div class="newdetailcon">
        <div class="biaoti"><img src="images/libg_06.jpg"><span id="news_title"></span></div>
        <div class="author_mess"><span>发布时间： <label id="news_time">2015-01-26 17:13</label> &nbsp;&nbsp;&nbsp;&nbsp;类别： <label id="news_class">新手学车</label>&nbsp;&nbsp;&nbsp;&nbsp;阅读：<label id="news_read">0</label></span></div>
        <div class="article_con">
            <p id="news_content">

            </p>
        </div>

            <div class="biaoti"><img src="images/libg_06.jpg"><span>相关新闻</span></div>
            <div class="contentnew">
                <ul class="contentnew_con" id="news_ul">
<%--                                 <li>--%>
<%--                                     <a href="test_kemu4.jsp" class="newsimg" ><img src="images/yijiakoa_24.jpg"></a>--%>
<%--                                     <div class="newrigcon">--%>
<%--                                         <h1><a href="test_kemu4.jsp">贵阳平安驾贵阳平安驾校科目四试题模拟练习校科目四试题模拟练习</a></h1>--%>
<%--                                         <p>贵阳平安驾校科目四贵阳平安驾校科目四试题模拟练习试题模拟练习...  </p>--%>
<%--                                     </div>--%>
<%--                                     <div class="clear"></div>--%>
<%--                                 </li>--%>
                </ul>
                <div class="noborder">&nbsp;</div>
            </div>

    </div>
</div>
<!-----------内容结束--------------->
<%--<div class="footer">--%>
<%--    <p>©考神驾到版权所有</p>--%>
<%--    <span>www.kaoshenjiadao.com</span>--%>
<%--</div>--%>

</body>

<script>
    var layer;
    layui.use('layer',function (){
        layer=layui.layer;
    })

    $("#page_head_title").text("新闻详情");

    var news_id_hidden=$("#news_id_hidden").val();

    window.onload=function(){
        initNews();
    }
    function initNews(){


        $.ajax({
            url:"${pageContext.request.contextPath}/front_news/news_read_init.do",
            data:{
                "news_id":news_id_hidden
            },
            success:function (data,status){


                $.ajax({
                    url:"${pageContext.request.contextPath}/front_news/news_detail_init.do",
                    data:{
                        "news_id":news_id_hidden
                    },
                    success:function (data,status){
                        if(status=="success"){
                            $("#news_title").text(data.news_title);
                            var time_str=new Date(parseInt(data.news_time)).toLocaleString().replace(/:\d{1,2}$/,'');
                            $("#news_time").text(time_str);
                            $("#news_class").text(data.news_class);
                            $("#news_read").text(data.news_read);
                            $("#news_content").html(data.news_content);
                            changeRelative_news(data.news_class,data.news_id);
                        }
                    }
                })


            }
        });





    }
    function changeRelative_news(news_class,news_id){
        $("#news_ul").empty();

        $.ajax({
            url:"${pageContext.request.contextPath}/front_news/news_relative.do",
            data:{
                "news_class":news_class,
                "news_id":news_id
            },
            success:function (data,status){
                if(status=="success"){
                    // <li><a href="#">·2015年株洲驾校综合考评新</a></li>
                    var path="${pageContext.request.contextPath}/img_artificial/news_img/";
                    for(var i=0;i<data.length;i++){
                        var li=$("<li></li>");
                        var a1=$("<a></a>").attr({
                            "href":"javascript:to_newsdetail("+data[i].news_id+");",
                            "class":"newsimg"
                        });
                        var img=$("<img>").attr("src",path+data[i].news_img);
                        a1.append(img);
                        var div=$("<div></div>").attr("class","newrigcon");
                        var h1=$("<h1></h1>");
                        var a2=$("<a></a>").attr("href","javascript:to_newsdetail("+data[i].news_id+");").text(data[i].news_title);
                        h1.append(a2);
                        var p=$("<p></p>").text(data[i].news_content);
                        div.append(h1,p);
                        var div_end=$("<div></div>").attr("class","clear");
                        var a3=$("<a></a>").attr("href","javascript:to_newsdetail("+data[i].news_id+");");
                        a3.append(a1,div,div_end);
                        li.append(a3);
                        $("#news_ul").append(li);
                    }
                }
            }
        })
    }

    function to_newsdetail(news_id){
        window.location.href="news_detail.jsp?news_id_hidden="+news_id;
    }
</script>









<!--头部高度赋给列表的topjs-->
<script>
    var heighttop=$(".top").height();
    $(".topmenu").css("top",heighttop);
    $(".menumore").toggle(function(){
        $(".topmenu").show();
    },function(){
        $(".topmenu").hide();
    })
    $(".buttontop").click(function(){
        $(".topmenu").hide();
    })

    $(function(){
        $(".tasecartop span a").click(function(){
            var $banktip=$(this).attr("tip");
            $($banktip).show().siblings().hide();
            $(".tasecartop span a").removeClass("payaclik");
            $(this).addClass("payaclik");
        })

    })
</script>

<!--头部高度赋给列表的topjs-->
<!--banner将图片的高度赋给父级扪js-->
<script>
    var heighta=$("#incltialiu li:eq(0) img").height();
    $(".main,.width,#incltialiu").height(heighta) ;
</script>
<!--banner将图片的高度赋给父级扪js-->
<!--首页标题点击出现更多分类js-->
<script>
    $(".titlemore").toggle(function(){
        $(this).parent(".tabtila").siblings(".moresort").show()
        $(this).children("img").attr("src","images/title_692.jpg")
    },function(){
        $(this).parent(".tabtila").siblings(".moresort").hide()
        $(this).children("img").attr("src","images/title_69.jpg")
    })
</script>
<!--首页标题点击出现更多分类js-->
</html>
